import { http } from '@/utils/http'

/** 查询对象存储配置列表 */
export function listOssConfig(params?: object) {
  return http.request<HttpPaginationResponse<Array<any>>>('get', '/resource/oss/config/list', {
    params,
  })
}

/** 新增对象存储配置 */
export function getOssConfig(ossConfigId: number) {
  return http.request<HttpResponse<Object>>('get', '/resource/oss/config/' + ossConfigId)
}

/** 修改对象存储配置 */
export const addOssConfig = (data?: object) => {
  return http.request<HttpResponse<Object>>('post', '/resource/oss/config', {
    data,
  })
}

/** 删除对象存储配置 */
export const updateOssConfig = (data?: object) => {
  return http.request<HttpResponse<Object>>('put', '/resource/oss/config', {
    data,
  })
}

/** 删除对象存储配置 */
export const delOssConfig = (postId?: string) => {
  return http.request<HttpResponse<Object>>('delete', `/resource/oss/config` + postId)
}

/** 对象存储状态修改 */
export const changeOssConfigStatus = (ossConfigId, status, configKey) => {
  const data = {
    ossConfigId,
    status,
    configKey,
  }
  return http.request<HttpResponse<Object>>('put', `/resource/oss/config/changeStatus`, {
    data,
  })
}
